From 7a57f20be7c4a776491c692c319a45256cb1c694 Mon Sep 17 00:00:00 2001 From: "kfraser@localhost.localdomain" Date: Mon, 23 Oct 2006 10:05:32 +0100 Subject: [PATCH] [BLOCK] blkback: Fix first_sect check. The blkback code checks first_sect by computing last_sect - first_sect + 1. If this is not positive then the request is rejected. Unfortunately, the calculation is stored in an unsigned integer before the check is made so negative values will not be rejected. This patch fixes this by explicitly comparing first_sect with last_sect. The blktap code is similar but it stores the difference in a signed integer so it's okay. Signed-off-by: Herbert Xu --- linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c index 106b4bf99d..37b33cbe4d 100644 --- a/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/blkback.c @@ -375,7 +375,7 @@ static void dispatch_rw_block_io(blkif_t *blkif, req->seg[i].first_sect + 1; if ((req->seg[i].last_sect >= (PAGE_SIZE >> 9)) || - (seg[i].nsec <= 0)) + (req->seg[i].last_sect < req->seg[i].first_sect)) goto fail_response; preq.nr_sects += seg[i].nsec; -- 2.30.2